<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.3.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"movie0125.gitee.io","root":"/","scheme":"Mist","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.xml"};
  </script>

  <meta name="description" content="LFS学习笔记（一）环境准备学习地址：LFS-BOOK实验环境：虚拟机，2C2G，系统盘64G,额外挂载一块硬盘，专门放新的LFS系统操作系统：UOS社区版,本章笔记对应 2-4 三个章节内容 注意：没有特殊说明，本实验所有操作都是在root用户下操作">
<meta property="og:type" content="article">
<meta property="og:title" content="lfs-notebook-01">
<meta property="og:url" content="https://movie0125.gitee.io/2021/05/10/lfs-notebook-01/index.html">
<meta property="og:site_name" content="Movie Blog">
<meta property="og:description" content="LFS学习笔记（一）环境准备学习地址：LFS-BOOK实验环境：虚拟机，2C2G，系统盘64G,额外挂载一块硬盘，专门放新的LFS系统操作系统：UOS社区版,本章笔记对应 2-4 三个章节内容 注意：没有特殊说明，本实验所有操作都是在root用户下操作">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2021-05-10T12:14:23.000Z">
<meta property="article:modified_time" content="2021-05-13T00:59:32.804Z">
<meta property="article:author" content="Movie">
<meta property="article:tag" content="LFS">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="https://movie0125.gitee.io/2021/05/10/lfs-notebook-01/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>lfs-notebook-01 | Movie Blog</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">Movie Blog</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">拥抱开源，快乐分享</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-fw fa-home"></i>首页</a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/about/" rel="section"><i class="fa fa-fw fa-user"></i>关于</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-fw fa-tags"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-fw fa-th"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-fw fa-archive"></i>归档</a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result">
  <div id="no-result">
    <i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
  </div>
</div>

    </div>
  </div>

</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>
  <div class="reading-progress-bar"></div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://movie0125.gitee.io/2021/05/10/lfs-notebook-01/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="Movie">
      <meta itemprop="description" content="学习，记录，分享，收获">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Movie Blog">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          lfs-notebook-01
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2021-05-10 20:14:23" itemprop="dateCreated datePublished" datetime="2021-05-10T20:14:23+08:00">2021-05-10</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2021-05-13 08:59:32" itemprop="dateModified" datetime="2021-05-13T08:59:32+08:00">2021-05-13</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/" itemprop="url" rel="index"><span itemprop="name">学习笔记</span></a>
                </span>
            </span>

          
            <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv" style="display: none;">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span id="busuanzi_value_page_pv"></span>
            </span>
  
  <span class="post-meta-item">
    
      <span class="post-meta-item-icon">
        <i class="fa fa-comment-o"></i>
      </span>
      <span class="post-meta-item-text">Valine：</span>
    
    <a title="valine" href="/2021/05/10/lfs-notebook-01/#valine-comments" itemprop="discussionUrl">
      <span class="post-comments-count valine-comment-count" data-xid="/2021/05/10/lfs-notebook-01/" itemprop="commentCount"></span>
    </a>
  </span>
  
  

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h1 id="LFS学习笔记（一）"><a href="#LFS学习笔记（一）" class="headerlink" title="LFS学习笔记（一）"></a>LFS学习笔记（一）</h1><h2 id="环境准备"><a href="#环境准备" class="headerlink" title="环境准备"></a>环境准备</h2><p>学习地址：<a target="_blank" rel="noopener" href="https://lctt.github.io/LFS-BOOK/lfs-sysv/prologue/audience.html">LFS-BOOK</a><br>实验环境：虚拟机，2C2G，系统盘64G,额外挂载一块硬盘，专门放新的LFS系统<br>操作系统：UOS社区版,<br>本章笔记对应 2-4 三个章节内容</p>
<p>注意：没有特殊说明，本实验所有操作都是在root用户下操作</p>
<a id="more"></a>

<p>安装对应的软件包 </p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">sudo apt update</span><br><span class="line">sudo apt install bison g++ texinfo</span><br><span class="line">ln -s /usr/bin/bash /bin/sh -f</span><br></pre></td></tr></table></figure>
<p>环境检查，执行如下脚本  <code>version-check.sh</code></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#!/bin/bash</span></span><br><span class="line"><span class="comment"># Simple script to list version numbers of critical development tools</span></span><br><span class="line"><span class="built_in">export</span> LC_ALL=C</span><br><span class="line">bash --version | head -n1 | cut -d<span class="string">&quot; &quot;</span> -f2-4</span><br><span class="line"></span><br><span class="line"><span class="comment"># /bin/sh 的链接是 bash</span></span><br><span class="line">MYSH=$(readlink -f /bin/sh)</span><br><span class="line"><span class="built_in">echo</span> <span class="string">&quot;/bin/sh -&gt; <span class="variable">$MYSH</span>&quot;</span></span><br><span class="line"><span class="built_in">echo</span> <span class="variable">$MYSH</span> | grep -q bash || <span class="built_in">echo</span> <span class="string">&quot;ERROR: /bin/sh does not point to bash&quot;</span></span><br><span class="line"><span class="built_in">unset</span> MYSH</span><br><span class="line"></span><br><span class="line"><span class="built_in">echo</span> -n <span class="string">&quot;Binutils: &quot;</span>; ld --version | head -n1 | cut -d<span class="string">&quot; &quot;</span> -f3-</span><br><span class="line">bison --version | head -n1</span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> [ -h /usr/bin/yacc ]; <span class="keyword">then</span></span><br><span class="line">  <span class="built_in">echo</span> <span class="string">&quot;/usr/bin/yacc -&gt; `readlink -f /usr/bin/yacc`&quot;</span>;</span><br><span class="line"><span class="keyword">elif</span> [ -x /usr/bin/yacc ]; <span class="keyword">then</span></span><br><span class="line">  <span class="built_in">echo</span> yacc is `/usr/bin/yacc --version | head -n1`</span><br><span class="line"><span class="keyword">else</span></span><br><span class="line">  <span class="built_in">echo</span> <span class="string">&quot;yacc not found&quot;</span> </span><br><span class="line"><span class="keyword">fi</span></span><br><span class="line"></span><br><span class="line">bzip2 --version 2&gt;&amp;1 &lt; /dev/null | head -n1 | cut -d<span class="string">&quot; &quot;</span> -f1,6-</span><br><span class="line"><span class="built_in">echo</span> -n <span class="string">&quot;Coreutils: &quot;</span>; chown --version | head -n1 | cut -d<span class="string">&quot;)&quot;</span> -f2</span><br><span class="line">diff --version | head -n1</span><br><span class="line">find --version | head -n1</span><br><span class="line">gawk --version | head -n1</span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> [ -h /usr/bin/awk ]; <span class="keyword">then</span></span><br><span class="line">  <span class="built_in">echo</span> <span class="string">&quot;/usr/bin/awk -&gt; `readlink -f /usr/bin/awk`&quot;</span>;</span><br><span class="line"><span class="keyword">elif</span> [ -x /usr/bin/awk ]; <span class="keyword">then</span></span><br><span class="line">  <span class="built_in">echo</span> awk is `/usr/bin/awk --version | head -n1`</span><br><span class="line"><span class="keyword">else</span> </span><br><span class="line">  <span class="built_in">echo</span> <span class="string">&quot;awk not found&quot;</span> </span><br><span class="line"><span class="keyword">fi</span></span><br><span class="line"></span><br><span class="line">gcc --version | head -n1</span><br><span class="line">g++ --version | head -n1</span><br><span class="line">ldd --version | head -n1 | cut -d<span class="string">&quot; &quot;</span> -f2-  <span class="comment"># glibc version</span></span><br><span class="line">grep --version | head -n1</span><br><span class="line">gzip --version | head -n1</span><br><span class="line">cat /proc/version</span><br><span class="line">m4 --version | head -n1</span><br><span class="line">make --version | head -n1</span><br><span class="line">patch --version | head -n1</span><br><span class="line"><span class="built_in">echo</span> Perl `perl -V:version`</span><br><span class="line">python3 --version</span><br><span class="line">sed --version | head -n1</span><br><span class="line">tar --version | head -n1</span><br><span class="line">makeinfo --version | head -n1  <span class="comment"># texinfo version</span></span><br><span class="line">xz --version | head -n1</span><br><span class="line"></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&#x27;int main()&#123;&#125;&#x27;</span> &gt; dummy.c &amp;&amp; g++ -o dummy dummy.c</span><br><span class="line"><span class="keyword">if</span> [ -x dummy ]</span><br><span class="line">  <span class="keyword">then</span> <span class="built_in">echo</span> <span class="string">&quot;g++ compilation OK&quot;</span>;</span><br><span class="line">  <span class="keyword">else</span> <span class="built_in">echo</span> <span class="string">&quot;g++ compilation failed&quot;</span>; <span class="keyword">fi</span></span><br><span class="line">rm -f dummy.c dummy</span><br></pre></td></tr></table></figure>

<p>虚拟机中检查结果如下，可以看到比 <a target="_blank" rel="noopener" href="https://lctt.github.io/LFS-BOOK/lfs-systemd/chapter02/hostreqs.html">LFS-BOOK</a> 中列出的版本高一些。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br></pre></td><td class="code"><pre><span class="line">bash, version 5.0.3(1)-release</span><br><span class="line">&#x2F;bin&#x2F;sh -&gt; &#x2F;usr&#x2F;bin&#x2F;bash</span><br><span class="line">Binutils: (GNU Binutils for Uos) 2.31.1</span><br><span class="line">bison (GNU Bison) 3.3.2</span><br><span class="line">&#x2F;usr&#x2F;bin&#x2F;yacc -&gt; &#x2F;usr&#x2F;bin&#x2F;bison.yacc</span><br><span class="line">bzip2,  Version 1.0.6, 6-Sept-2010.</span><br><span class="line">Coreutils:  8.30</span><br><span class="line">diff (GNU diffutils) 3.7</span><br><span class="line">find (GNU findutils) 4.6.0.225-235f</span><br><span class="line">GNU Awk 4.2.1, API: 2.0 (GNU MPFR 4.0.2, GNU MP 6.1.2)</span><br><span class="line">&#x2F;usr&#x2F;bin&#x2F;awk -&gt; &#x2F;usr&#x2F;bin&#x2F;gawk</span><br><span class="line">gcc (Uos 8.3.0.3-3+rebuild) 8.3.0</span><br><span class="line">g++ (Uos 8.3.0.3-3+rebuild) 8.3.0</span><br><span class="line">(Debian GLIBC 2.28.12-1+eagle) 2.28</span><br><span class="line">grep (GNU grep) 3.3</span><br><span class="line">gzip 1.9</span><br><span class="line">Linux version 5.10.29-amd64-desktop (uos@deepin-PC) (gcc (Uos 8.3.0.3-3+rebuild) 8.3.0, GNU ld (GNU Binutils for Uos) 2.31.1) #2 SMP Mon Apr 26 09:48:13 CST 2021</span><br><span class="line">m4 (GNU M4) 1.4.18</span><br><span class="line">GNU Make 4.2.1</span><br><span class="line">GNU patch 2.7.6</span><br><span class="line">Perl version&#x3D;&#39;5.28.1&#39;;</span><br><span class="line">Python 3.7.3</span><br><span class="line">sed (GNU sed) 4.7</span><br><span class="line">tar (GNU tar) 1.30</span><br><span class="line">texi2any (GNU texinfo) 6.5</span><br><span class="line">xz (XZ Utils) 5.2.4</span><br><span class="line">g++ compilation OK</span><br></pre></td></tr></table></figure>
<h3 id="磁盘分区准备"><a href="#磁盘分区准备" class="headerlink" title="磁盘分区准备"></a>磁盘分区准备</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># lsblk </span></span><br><span class="line">NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT</span><br><span class="line">sr0     11:0    1 1024M  0 rom  </span><br><span class="line">vda    252:0    0   64G  0 disk </span><br><span class="line">├─vda1 252:1    0  1.5G  0 part /boot</span><br><span class="line">├─vda2 252:2    0    1K  0 part </span><br><span class="line">├─vda3 252:3    0   11G  0 part /recovery</span><br><span class="line">├─vda4 252:4    0    3G  0 part [SWAP]</span><br><span class="line">├─vda5 252:5    0   15G  0 part /</span><br><span class="line">├─vda6 252:6    0   15G  0 part </span><br><span class="line">└─vda7 252:7    0 18.5G  0 part /data</span><br><span class="line">vdb    252:16   0   20G  0 disk </span><br><span class="line"></span><br><span class="line"><span class="comment"># mkfs -v -t ext4 /dev/vdb </span></span><br><span class="line">mke2fs 1.44.5 (15-Dec-2018)</span><br><span class="line">fs_types <span class="keyword">for</span> mke2fs.conf resolution: <span class="string">&#x27;ext4&#x27;</span></span><br><span class="line">Filesystem label=</span><br><span class="line">OS <span class="built_in">type</span>: Linux</span><br><span class="line">Block size=4096 (<span class="built_in">log</span>=2)</span><br><span class="line">Fragment size=4096 (<span class="built_in">log</span>=2)</span><br><span class="line">Stride=0 blocks, Stripe width=0 blocks</span><br><span class="line">1310720 inodes, 5242880 blocks</span><br><span class="line">262144 blocks (5.00%) reserved <span class="keyword">for</span> the super user</span><br><span class="line">First data block=0</span><br><span class="line">Maximum filesystem blocks=2153775104</span><br><span class="line">160 block groups</span><br><span class="line">32768 blocks per group, 32768 fragments per group</span><br><span class="line">8192 inodes per group</span><br><span class="line">Filesystem UUID: 12cd819e-24ee-4b40-b567-9d06babdc7f4</span><br><span class="line">Superblock backups stored on blocks: </span><br><span class="line">        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, </span><br><span class="line">        4096000</span><br><span class="line"></span><br><span class="line">Allocating group tables: <span class="keyword">done</span>                            </span><br><span class="line">Writing inode tables: <span class="keyword">done</span>                            </span><br><span class="line">Creating journal (32768 blocks): <span class="keyword">done</span></span><br><span class="line">Writing superblocks and filesystem accounting information: <span class="keyword">done</span>   </span><br><span class="line"></span><br></pre></td></tr></table></figure>

<h3 id="环境变量准备"><a href="#环境变量准备" class="headerlink" title="环境变量准备"></a>环境变量准备</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">export</span> LFS=/mnt/lfs</span><br><span class="line">mkdir -pv <span class="variable">$LFS</span></span><br><span class="line">mount -v -t ext4 /dev/vdb <span class="variable">$LFS</span></span><br><span class="line">mkdir -v <span class="variable">$LFS</span>/sources</span><br><span class="line">chmod -v a+wt <span class="variable">$LFS</span>/sources</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h3 id="软件下载"><a href="#软件下载" class="headerlink" title="软件下载"></a>软件下载</h3><p>下载所有软件包</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"><span class="comment"># 下载软件包列表，并批量下载软件包</span></span><br><span class="line">wget https://raw.githubusercontent.com/LCTT/LFS-BOOK/9.0-translating/wget-list-ustc -O source-list</span><br><span class="line">wget --input-file=source-list --<span class="built_in">continue</span> --directory-prefix=<span class="variable">$LFS</span>/sources</span><br><span class="line"></span><br><span class="line"><span class="comment"># 下载软件包md5校验码</span></span><br><span class="line">wget https://lctt.github.io/LFS-BOOK/lfs-systemd/md5sums --directory-prefix=<span class="variable">$LFS</span>/sources</span><br><span class="line"></span><br><span class="line"><span class="built_in">cd</span> <span class="variable">$LFS</span>/sources </span><br><span class="line"><span class="built_in">pushd</span> <span class="variable">$LFS</span>/sources</span><br><span class="line">md5sum -c md5sums</span><br><span class="line"><span class="built_in">popd</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h3 id="额外的准备工作"><a href="#额外的准备工作" class="headerlink" title="额外的准备工作"></a>额外的准备工作</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">mkdir -v <span class="variable">$LFS</span>/tools</span><br><span class="line">ln -sv <span class="variable">$LFS</span>/tools /</span><br><span class="line"></span><br><span class="line">groupadd lfs</span><br><span class="line">useradd -s /bin/bash -g lfs -m -k /dev/null lfs</span><br><span class="line"></span><br><span class="line">passwd lfs</span><br><span class="line">chown -v lfs <span class="variable">$LFS</span>/tools</span><br><span class="line">chown -v lfs <span class="variable">$LFS</span>/sources</span><br><span class="line">su - lfs</span><br><span class="line">cat &gt; ~/.bash_profile &lt;&lt; <span class="string">&quot;EOF&quot;</span></span><br><span class="line">env -i HOME=<span class="variable">$HOME</span> TERM=<span class="variable">$TERM</span> PS1=<span class="string">&#x27;\u:\w\$ &#x27;</span> /bin/bash</span><br><span class="line">EOF</span><br><span class="line"></span><br><span class="line">cat &gt; ~/.bashrc &lt;&lt; <span class="string">&quot;EOF&quot;</span></span><br><span class="line"><span class="built_in">set</span> +h</span><br><span class="line"><span class="built_in">umask</span> 022</span><br><span class="line">LFS=/mnt/lfs</span><br><span class="line">LC_ALL=POSIX</span><br><span class="line">LFS_TGT=$(uname -m)-lfs-linux-gnu</span><br><span class="line">PATH=/tools/bin:/bin:/usr/bin</span><br><span class="line"><span class="built_in">export</span> LFS LC_ALL LFS_TGT PATH</span><br><span class="line">EOF</span><br></pre></td></tr></table></figure>
    </div>

    
    
    

      <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/LFS/" rel="tag"># LFS</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2021/03/09/ceph-crc-failed-at-Kunpeng920/" rel="prev" title="ceph-crc-failed-at-Kunpeng920">
      <i class="fa fa-chevron-left"></i> ceph-crc-failed-at-Kunpeng920
    </a></div>
      <div class="post-nav-item">
    <a href="/2021/05/11/lfs-notebook-02/" rel="next" title="lfs-notebook-02">
      lfs-notebook-02 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          
    <div class="comments" id="valine-comments"></div>

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#LFS%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0%EF%BC%88%E4%B8%80%EF%BC%89"><span class="nav-number">1.</span> <span class="nav-text">LFS学习笔记（一）</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E7%8E%AF%E5%A2%83%E5%87%86%E5%A4%87"><span class="nav-number">1.1.</span> <span class="nav-text">环境准备</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E7%A3%81%E7%9B%98%E5%88%86%E5%8C%BA%E5%87%86%E5%A4%87"><span class="nav-number">1.1.1.</span> <span class="nav-text">磁盘分区准备</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F%E5%87%86%E5%A4%87"><span class="nav-number">1.1.2.</span> <span class="nav-text">环境变量准备</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E8%BD%AF%E4%BB%B6%E4%B8%8B%E8%BD%BD"><span class="nav-number">1.1.3.</span> <span class="nav-text">软件下载</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E9%A2%9D%E5%A4%96%E7%9A%84%E5%87%86%E5%A4%87%E5%B7%A5%E4%BD%9C"><span class="nav-number">1.1.4.</span> <span class="nav-text">额外的准备工作</span></a></li></ol></li></ol></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">Movie</p>
  <div class="site-description" itemprop="description">学习，记录，分享，收获</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">14</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">3</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">7</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2022</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Movie</span>
</div>

        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/muse.js"></script>


<script src="/js/next-boot.js"></script>




  




  
<script src="/js/local-search.js"></script>











<script>
if (document.querySelectorAll('pre.mermaid').length) {
  NexT.utils.getScript('//cdn.jsdelivr.net/npm/mermaid@8/dist/mermaid.min.js', () => {
    mermaid.initialize({
      theme    : 'forest',
      logLevel : 3,
      flowchart: { curve     : 'linear' },
      gantt    : { axisFormat: '%m/%d/%Y' },
      sequence : { actorMargin: 50 }
    });
  }, window.mermaid);
}
</script>


  

  


<script>
NexT.utils.loadComments(document.querySelector('#valine-comments'), () => {
  NexT.utils.getScript('//unpkg.com/valine/dist/Valine.min.js', () => {
    var GUEST = ['nick', 'mail', 'link'];
    var guest = 'nick,mail,link';
    guest = guest.split(',').filter(item => {
      return GUEST.includes(item);
    });
    new Valine({
      el         : '#valine-comments',
      verify     : false,
      notify     : false,
      appId      : 'bx3R5BB7VYCe0Yu5f4PF2Ako-gzGzoHsz',
      appKey     : '24eOkgM1v8hYTlnAO3C2eG3n',
      placeholder: "欢迎留言评论",
      avatar     : 'mm',
      meta       : guest,
      pageSize   : '10' || 10,
      visitor    : false,
      lang       : 'zh-cn' || 'zh-cn',
      path       : location.pathname,
      recordIP   : false,
      serverURLs : ''
    });
  }, window.Valine);
});
</script>

</body>
</html>
